<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>前三金额查询</title>
<jsp:include page="/common.jsp"></jsp:include>
<c:if test="${type=='0' }">
	<c:set var="cntype" value="日"></c:set>
</c:if>
<c:if test="${type=='1' }">
	<c:set var="cntype" value="月"></c:set>
</c:if>
<script type="text/javascript">
$(function () {
    var chart;
    $(document).ready(function() {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                type: 'column'
            },
            title: {
                text: '${cntype}金额'
            },
            subtitle: {
                text: ''
            },
            xAxis: {
                categories: [
                   ''
                ]
            },
            yAxis: {
                min: 0,
                title: {
                    text: '金额(元)'
                }
            },
            legend: {
                layout: 'vertical',
                backgroundColor: '#FFFFFF',
                align: 'left',
                verticalAlign: 'top',
                x: 100,
                y: 70,
                floating: true,
                shadow: true
            },
            tooltip: {
                formatter: function() {
                    return ''+
                        this.x +': '+ this.y +' 元';
                }
            },
            plotOptions: {
                column: {
                    pointPadding: 0.2,
                    borderWidth: 0
                }
            },
            series: [${series }]
        });
    });
});
function query(obj){
	
	var form = $('#form').serialize(); 
	
	switch (obj) {
	case "+":
		window.location.href=basePath+"sales/salesTicket?queryTop3Price&"+form+"&num=20";
		break;
	case "-":
		window.location.href=basePath+"sales/salesTicket?queryTop3Price&"+form+"&num=3";
	default:
		break;
	}
}
</script>
</head>
<body>
<form action="" id="form">
	<input type="hidden" name="type" value="${type }">
	<input type="hidden" name="status" value="${status }">
	<input type="hidden" name="date" value="${date }">
	<input type="hidden" name="saler" value="${saler }">
	<input type="hidden" name="shop" value="${shop }">
</form>
<div class="breadcrumb alert-success">金额:</div>
	<table
		class="table table-striped table-bordered table-condensed  table-hover">
		<thead>
			<tr>
				<th>编号</th>
				<th>名称</th>
				<th>金额</th>
			</tr>
		</thead>
		<tbody>
			<c:set var="num" value="0"></c:set>
			<c:forEach var="salesTicket" items="${t }">
				<c:set var="num" value="${num+1 }" />
				<c:if test="${num<=3 }">
				<input type="hidden" name="p_name${num }" value="${salesTicket.p_name }">
				<input type="hidden" name="price${num }" value="${salesTicket.price }">
						<tr>
						<td>${num }</td>
						<td>${salesTicket.p_name }</td>
						<td>${salesTicket.price }</td>
					</tr>
				</c:if>
			</c:forEach>
		</tbody>
	</table>
	<div class="navbar">
		<div class="pull-right">
			<button class="btn" onclick="query('+')">+</button>
			<button class="btn" onclick="query('-')">-</button>
		</div>
	</div>
	<div id="container" style="height: 300px; margin: 0 auto;width: 100%"></div>
	<div class="control-group">
		<div class="controls">
			<a class="btn btn-primary" onclick="history.back()">返回</a>
		</div>
	</div>
</body>
</html>